<template>
  <div class="Cousnt">
    <h1>{{ name }}</h1>
    <p>count的值是{{ count }}</p>
    <button @click="changeName">改变count的值</button>
  </div>
</template>

<script>
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Count",
  props: {
    init: {
      type: Number,
      default: 0,
      required: true
    }
  },
  data() {
    return {
      count: this.init,
      name: "Count"
    };
  },
  methods: {
    changeName() {
      // 改变count的值
      this.count++;
    }
  },
};
</script>

<style>
.Count {
  color: rgb(52, 73, 207);
}
</style>
